<?php

$opts = stream_context_create();
// stream_context_set_option($opts,'socket', 'so_reuseport', 1);

$server = stream_socket_server('tcp://127.0.0.1:4785',$errno, $errstr,null,$opts);

$client_opts = stream_context_create();

stream_context_set_option($client_opts,'socket','bind_to','0:4785');

$client = stream_socket_client('udp://127.0.0.1:4785',$errno, $errstr,30, STREAM_CLIENT_CONNECT,$opts);